Descriptives

Sample Size

## # A tibble: 6 × 3
## # Groups:   Site, treatment [6]
##   Site     treatment     n
##   <chr>    <chr>     <dbl>
## 1 Isolated Loud         10
## 2 Isolated Quiet        11
## 3 Rural    Loud         15
## 4 Rural    Quiet        15
## 5 Urban    Loud         15
## 6 Urban    Quiet        15

Age and Condition

## 
##  Shapiro-Wilk normality test
## 
## data:  rank(spiders2$trial_age)
## W = 0.94982, p-value = 0.01528
## Anova Table (Type II tests)
## 
## Response: log(trial_age)
##                Sum Sq Df F value Pr(>F)
## Site           0.0127  1  0.2141 0.6453
## treatment      0.0693  1  1.1662 0.2848
## Site:treatment 0.0026  1  0.0443 0.8341
## Residuals      3.3285 56
## Analysis of Deviance Table (Type II tests)
## 
## Response: trial_age
##                LR Chisq Df Pr(>Chisq)
## Site            0.09268  1     0.7608
## treatment       1.19461  1     0.2744
## Site:treatment  0.05266  1     0.8185
## 
##  Shapiro-Wilk normality test
## 
## data:  spiders2$condition
## W = 0.96166, p-value = 0.05675
## Anova Table (Type II tests)
## 
## Response: condition
##                 Sum Sq Df F value Pr(>F)
## Site           0.01352  1  0.5974 0.4428
## treatment      0.01918  1  0.8471 0.3613
## Site:treatment 0.00471  1  0.2081 0.6500
## Residuals      1.26758 56

Ambient Before vs. After

Close vs Far Overall

Field Noise and Playback

noise_sum <- noise  %>% 
  group_by(Site, Low_Freq) %>% 
  summarize(mean_leq = mean(Leq),
            se_leq = plotrix::std.error(Leq))  %>% 
  mutate(Site = factor(Site),
         Site = fct_recode(Site, "Urban" = "campus", "Rural" = "popes"),
         Site = fct_relevel(Site, "Rural", "Urban"))

noise_sum %>% 
  filter(! Low_Freq < 20) %>% 
  ggplot() +
    annotate(geom = "rect", ymin = -95, ymax = -13, xmin = range_min, xmax = range_max, fill = "grey90") +
  geom_vline(xintercept = range_max, linetype = "dashed", color = "#d95f02") +
  geom_vline(xintercept = range_min, linetype = "dashed", color = "#1b9e77") +
  geom_line(aes(x = Low_Freq, y = mean_leq, color = Site), size = 1) +
  geom_ribbon(aes(x = Low_Freq, ymin = mean_leq - se_leq, ymax = mean_leq + se_leq, fill = Site), alpha = 0.5) +
  xlab("Frequency (10 Hz Bins)") +
  ylab("Amplitude (Leq, dB)\nQuieter <------------> Louder") +
  scale_color_manual("Collection Site", values = c("#1b9e77", "#d95f02")) +
  scale_fill_manual("Collection Site", values = c("#1b9e77", "#d95f02")) +
  scale_y_continuous(limits = c(-95, -13), breaks = c(-90, -75, -60, -45, -30, -15), expand = c(0,0)) +
  #scale_x_continuous(expand = c(0,0)) +
  theme_classic() +
  theme(axis.text = element_text(size = 14, color = "black", family = "sans"),
        axis.title = element_text(size = 14, color = "black", family = "sans"),
        legend.text = element_text(size = 14, color = "black", family = "sans"),
        legend.title = element_text(size = 14, color = "black", family = "sans"),
        legend.position = "top")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

noise_sum_urban <- noise_sum %>% 
  filter(Site == "Urban",
         ! Low_Freq < 20)
urban_dY <- diff(noise_sum_urban$mean_leq)/diff(noise_sum_urban$Low_Freq) 
urban_dX <- rowMeans(embed(noise_sum_urban$Low_Freq,2))
derivativeData_u <- data.frame(X = urban_dX, Y = urban_dY, type = "Derivative", Site = "Urban")

noise_sum_rural <- noise_sum %>% 
  filter(Site == "Rural",
         ! Low_Freq < 20)
rural_dY <- diff(noise_sum_rural$mean_leq)/diff(noise_sum_rural$Low_Freq) 
rural_dX <- rowMeans(embed(noise_sum_rural$Low_Freq,2))
derivativeData_r <- data.frame(X = rural_dX, Y = rural_dY, type = "Derivative", Site = "Rural")

derivativeData <- rbind(derivativeData_u, derivativeData_r) 

derivativeData2 <- derivativeData %>% 
  pivot_wider(names_from = "Site", values_from = "Y") %>% 
  mutate(diff = round(Urban-Rural, 2))

ggplot(derivativeData, aes(X,Y, color = Site)) + 
  geom_line(size = 1) +
  geom_hline(yintercept = -0.0116700000, linetype = "dashed") +
  geom_hline(yintercept = -0.0129166667, linetype = "dashed") +

  geom_vline(xintercept = range_min, linetype = "dashed", color = "#1b9e77") +
  geom_vline(xintercept = range_max, linetype = "dashed", color = "#d95f02") +
  xlab("Frequency (10 Hz Bins)") +
  ylab("First Derivative of Amplitude/Frequency") +
  scale_color_manual("Collection Site", values = c("#1b9e77", "#d95f02")) +
  scale_y_continuous(limits = c(-0.2, 0.2)) +
  theme_classic() +
  theme(axis.text = element_text(size = 14, color = "black", family = "sans"),
        axis.title = element_text(size = 14, color = "black", family = "sans"),
        legend.text = element_text(size = 14, color = "black", family = "sans"),
        legend.title = element_text(size = 14, color = "black", family = "sans"),
        legend.position = "top")

#rural_dY2 <- diff(derivativeData_r$Y)/diff(derivativeData_r$X) 
#rural_dX2 <- rowMeans(embed(derivativeData_r$X,2))
#derivativeData_r2 <- data.frame(X2 = rural_dX2, Y2 = rural_dY2, type = "Derivative2", Site = "Rural")

#urban_dY2 <- diff(derivativeData_u$Y)/diff(derivativeData_u$X) 
#urban_dX2 <- rowMeans(embed(derivativeData_u$X,2))
#derivativeData_u2 <- data.frame(X2 = urban_dX2, Y2 = urban_dY2, type = "Derivative2", Site = "Urban")

#derivativeData2 <- rbind(derivativeData_u2, derivativeData_r2) 

#ggplot(derivativeData2, aes(X2,Y2, color = Site)) + 
#  geom_line(size = 1) +
#  geom_hline(yintercept = 0.000095, linetype = "dashed") +
#  geom_hline(yintercept = 0, linetype = "dashed") +
#  geom_vline(xintercept = 380, linetype = "dashed", color = #"#1b9e77") +
#  geom_vline(xintercept = 740, linetype = "dashed", color = #"#d95f02") +
#  xlab("Frequency (10 Hz Bins)") +
#  ylab("Second Derivative of Amplitude/Frequency") +
#  scale_color_manual("Collection Site", values = c("#1b9e77", #"#d95f02")) +
#  theme_classic() +
#  scale_y_continuous(limits = c(-0.0010, 0.0010)) +
#  theme(axis.text = element_text(size = 14, color = "black", #family = "sans"),
#        axis.title = element_text(size = 14, color = "black", #family = "sans"),
#        legend.text = element_text(size = 14, color = #"black", family = "sans"),
#        legend.title = element_text(size = 14, color = #"black", family = "sans"),
#        legend.position = "top")


playback <- read.csv("data/playback.csv")

playback %>% 
  ggplot() +
  geom_vline(xintercept = range_min) +
  geom_vline(xintercept = range_max) +
  geom_line(aes(x = frequency, y = Leq, group = interaction(tub, treatment), color = treatment)) +
  xlab("Frequency (10 Hz Bins)") +
  ylab("Corrected Amplitude (Leq, dB)") +
  scale_color_manual(values = c("#d95f02", "#1b9e77")) +
  #scale_y_continuous(limits = c(0, 40), breaks = c(seq(0, 40, 5))) +
  theme_classic() +
  theme(axis.text = element_text(size = 12, color = "black"),
        axis.title = element_text(size = 12, color = "black"),
        legend.text = element_text(size = 12, color = "black"),
        legend.title = element_text(size = 12, color = "black"),
        legend.position = "top")

playback %>%  
  filter(! frequency < 20) %>% 
  group_by(treatment, frequency) %>% 
  summarize(mean_leq = mean(leq_test),
            se_leq = plotrix::std.error(leq_test)) %>% 
  ggplot() +
  annotate(geom = "rect", ymin = -95, ymax = -13, xmin = range_min, xmax = range_max, fill = "grey90") +
  geom_vline(xintercept = range_min, linetype = "dashed", color = "#1b9e77") +
  geom_vline(xintercept = range_max, linetype = "dashed", color = "#d95f02") +
  geom_line(aes(x = frequency, y = mean_leq, color = treatment)) +
  geom_ribbon(aes(x = frequency, ymin = mean_leq - se_leq, ymax = mean_leq + se_leq, fill = treatment), alpha = 0.5) +
  xlab("Frequency (10 Hz Bins)") +
  ylab("Amplitude (Leq, dB)\nQuieter <------------> Louder") +
  scale_color_manual("Treatment", values = c("#d95f02", "#1b9e77"),
                     labels = c("Loud", "Quiet")) +
  scale_fill_manual("Treatment", values = c("#d95f02", "#1b9e77"),
                     labels = c("Loud", "Quiet")) +
  scale_y_continuous(limits = c(-95, -13), breaks = c(-90, -75, -60, -45, -30, -15), expand = c(0,0)) +
  theme_classic() +
  theme(axis.text = element_text(size = 14, color = "black", family = "sans"),
        axis.title = element_text(size = 14, color = "black", family = "sans"),
        legend.text = element_text(size = 14, color = "black", family = "sans"),
        legend.title = element_text(size = 14, color = "black", family = "sans"),
        legend.position = "top",
        #legend.key.size = unit(1, "cm")
        )

Stimulus

Research Questions

Vibration Transmissiion

Do webs built by urban and rural spiders under different vibratory conditions differ in the frequency transmission properties?

## 
##  Shapiro-Wilk normality test
## 
## data:  close_1000$mean_leq
## W = 0.99233, p-value = 0.7515
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: mean_leq
##                       Chisq Df        Pr(>Chisq)    
## Site                 0.0000  1           1.00000    
## treatment            0.0000  1           1.00000    
## Freq                48.9885  1 0.000000000002575 ***
## Site:treatment       0.0000  1           1.00000    
## Site:Freq            0.9538  1           0.32876    
## treatment:Freq       1.2335  1           0.26673    
## Site:treatment:Freq  5.8919  1           0.01521 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Site = Rural, treatment = Quiet:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)    2.577 0.774 56   3.330  0.0015
## 
## Site = Urban, treatment = Quiet:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)    3.701 0.774 56   4.780  <.0001
## 
## Site = Rural, treatment = Loud:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)    3.597 0.774 56   4.646  <.0001
## 
## Site = Urban, treatment = Loud:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)    0.962 0.774 56   1.242  0.2193
## 
## Degrees-of-freedom method: kenward-roger
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 12.873, df = 1, p-value = 0.0003334
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 8.551, df = 1, p-value = 0.003453
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 1.8172, df = 1, p-value = 0.1776
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 16.355, df = 1, p-value = 0.00005252

## Warning in predict.merMod(model_close_1000, newdata = nd, se.fit = TRUE, :
## unused arguments ignored

## 
##  Shapiro-Wilk normality test
## 
## data:  far_1000$mean_leq
## W = 0.95461, p-value = 0.0004788
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: mean_leq
##                       Chisq Df Pr(>Chisq)    
## Site                 0.0000  1     1.0000    
## treatment            0.0000  1     1.0000    
## Freq                17.5437  1 0.00002808 ***
## Site:treatment       0.0000  1     1.0000    
## Site:Freq            0.0019  1     0.9651    
## treatment:Freq       0.0501  1     0.8230    
## Site:treatment:Freq  0.8913  1     0.3451    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Site = Rural, treatment = Loud:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)   -0.955 0.623 56  -1.532  0.1311
## 
## Site = Urban, treatment = Loud:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)   -1.516 0.623 56  -2.433  0.0182
## 
## Site = Rural, treatment = Quiet:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)   -1.683 0.623 56  -2.700  0.0092
## 
## Site = Urban, treatment = Quiet:
##  contrast               estimate    SE df t.ratio p.value
##  (0-1000) - (1000-2000)   -1.067 0.623 56  -1.712  0.0924
## 
## Degrees-of-freedom method: kenward-roger
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 0.95011, df = 1, p-value = 0.3297
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 4.2155, df = 1, p-value = 0.04006
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 5.8877, df = 1, p-value = 0.01525
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Freq
## Kruskal-Wallis chi-squared = 5.6882, df = 1, p-value = 0.01708

## Warning in predict.merMod(model_far_1000, newdata = nd, se.fit = TRUE, re.form =
## NA, : unused arguments ignored

## 
##  Shapiro-Wilk normality test
## 
## data:  close_noise$mean_leq
## W = 0.98648, p-value = 0.7464
## Anova Table (Type II tests)
## 
## Response: mean_leq
##                 Sum Sq Df F value  Pr(>F)  
## Site             16.14  1  0.7836 0.37983  
## treatment         2.34  1  0.1136 0.73732  
## Site:treatment   79.07  1  3.8389 0.05506 .
## Residuals      1153.40 56                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## treatment = Quiet:
##  contrast      estimate   SE df t.ratio p.value
##  Rural - Urban    -1.26 1.66 56  -0.760  0.4507
## 
## treatment = Loud:
##  contrast      estimate   SE df t.ratio p.value
##  Rural - Urban     3.33 1.66 56   2.011  0.0491
## Site = Rural:
##  contrast     estimate   SE df t.ratio p.value
##  Quiet - Loud    -1.90 1.66 56  -1.147  0.2562
## 
## Site = Urban:
##  contrast     estimate   SE df t.ratio p.value
##  Quiet - Loud     2.69 1.66 56   1.624  0.1100

## 
##  Shapiro-Wilk normality test
## 
## data:  far_noise$mean_leq
## W = 0.9366, p-value = 0.003828
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Site
## Kruskal-Wallis chi-squared = 4.2155, df = 1, p-value = 0.04006
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by Site
## Kruskal-Wallis chi-squared = 1.3974, df = 1, p-value = 0.2372
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by treatment
## Kruskal-Wallis chi-squared = 0.41333, df = 1, p-value = 0.5203
## 
##  Kruskal-Wallis rank sum test
## 
## data:  mean_leq by treatment
## Kruskal-Wallis chi-squared = 2.6843, df = 1, p-value = 0.1013

Isolated

Frequency Response

Do spiders shift their response to frequencies based on experience with different vibratory conditions?

2022 - Deciding to pool rural but not urban (campus only)

## # A tibble: 4 × 2
## # Groups:   Location [4]
##   Location     n
##   <chr>    <int>
## 1 Campus     230
## 2 Corman     120
## 3 Herman     200
## 4 Pope       120
## # A tibble: 2 × 2
## # Groups:   Site [2]
##   Site      n
##   <chr> <int>
## 1 Rural   320
## 2 Urban   350
## # A tibble: 4 × 2
## # Groups:   Location [4]
##   Location     n
##   <chr>    <int>
## 1 Campus     190
## 2 Corman     110
## 3 Herman     200
## 4 Pope       100
## # A tibble: 2 × 2
## # Groups:   Site [2]
##   Site      n
##   <chr> <int>
## 1 Rural   300
## 2 Urban   300

Frequency Response

## # A tibble: 6 × 3
## # Groups:   Group, Site [6]
##   Group      Site      n
##   <fct>      <chr> <int>
## 1 2022       Rural   320
## 2 2022       Urban   230
## 3 2023_Quiet Rural   120
## 4 2023_Quiet Urban   140
## 5 2023_Loud  Rural   100
## 6 2023_Loud  Urban   130

## # A tibble: 6 × 3
## # Groups:   Group, Site [6]
##   Group      Site      n
##   <fct>      <chr> <int>
## 1 2022       Rural   300
## 2 2022       Urban   190
## 3 2023_Quiet Rural    70
## 4 2023_Quiet Urban   120
## 5 2023_Loud  Rural    60
## 6 2023_Loud  Urban   100

## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

Isolated Frequency Responses

## # A tibble: 4 × 3
## # Groups:   before_after, treatment [4]
##   before_after treatment     n
##   <chr>        <chr>     <int>
## 1 After        Loud         60
## 2 After        Quiet        40
## 3 Before       Loud        100
## 4 Before       Quiet       100

## # A tibble: 4 × 3
## # Groups:   before_after, treatment [4]
##   before_after treatment     n
##   <chr>        <chr>     <int>
## 1 After        Loud         50
## 2 After        Quiet        30
## 3 Before       Loud         80
## 4 Before       Quiet        90

Silk Mass

## 
##  Shapiro-Wilk normality test
## 
## data:  log(silk$dry_microg_body_mg)
## W = 0.95149, p-value = 0.01831
## Anova Table (Type II tests)
## 
## Response: log(dry_microg_body_mg)
##                Sum Sq Df F value Pr(>F)
## Site            1.564  1  2.0345 0.1593
## treatment       0.042  1  0.0541 0.8169
## Site:treatment  1.151  1  1.4971 0.2262
## Residuals      43.041 56
## Site = Rural:
##  contrast     estimate   SE df t.ratio p.value
##  Quiet - Loud   -0.224 0.32 56  -0.701  0.4864
## 
## Site = Urban:
##  contrast     estimate   SE df t.ratio p.value
##  Quiet - Loud    0.330 0.32 56   1.030  0.3076
## 
## Results are given on the log (not the response) scale.
## treatment = Quiet:
##  contrast      estimate   SE df t.ratio p.value
##  Rural - Urban   0.0459 0.32 56   0.143  0.8865
## 
## treatment = Loud:
##  contrast      estimate   SE df t.ratio p.value
##  Rural - Urban   0.5998 0.32 56   1.874  0.0662
## 
## Results are given on the log (not the response) scale.
## 
##  Kruskal-Wallis rank sum test
## 
## data:  dry_microg_body_mg by Site
## Kruskal-Wallis chi-squared = 3.4069, df = 1, p-value = 0.06493
## 
##  Kruskal-Wallis rank sum test
## 
## data:  dry_microg_body_mg by Site
## Kruskal-Wallis chi-squared = 0.021075, df = 1, p-value = 0.8846

## 
##  Shapiro-Wilk normality test
## 
## data:  log(silk$moisture_per)
## W = 0.95805, p-value = 0.03781
## Anova Table (Type II tests)
## 
## Response: log(moisture_per)
##                 Sum Sq Df F value  Pr(>F)  
## Site            0.5465  1  1.0878 0.30143  
## treatment       1.7789  1  3.5411 0.06507 .
## Site:treatment  0.9967  1  1.9840 0.16450  
## Residuals      28.1323 56                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Kruskal-Wallis rank sum test
## 
## data:  moisture_per by treatment
## Kruskal-Wallis chi-squared = 0.096774, df = 1, p-value = 0.7557
## 
##  Kruskal-Wallis rank sum test
## 
## data:  moisture_per by treatment
## Kruskal-Wallis chi-squared = 3.8817, df = 1, p-value = 0.04881
## Analysis of Deviance Table (Type II tests)
## 
## Response: moisture_per
##                Df  Chisq Pr(>Chisq)  
## Site            1 0.6103    0.43468  
## treatment       1 3.0969    0.07844 .
## Site:treatment  1 2.1328    0.14418  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Site = Rural:
##  contrast     estimate     SE  df z.ratio p.value
##  Quiet - Loud  -0.1009 0.0441 Inf  -2.290  0.0220
## 
## Site = Urban:
##  contrast     estimate     SE  df z.ratio p.value
##  Quiet - Loud  -0.0119 0.0466 Inf  -0.256  0.7978
## treatment = Quiet:
##  contrast      estimate     SE  df z.ratio p.value
##  Rural - Urban  -0.0684 0.0426 Inf  -1.605  0.1085
## 
## treatment = Loud:
##  contrast      estimate     SE  df z.ratio p.value
##  Rural - Urban   0.0206 0.0480 Inf   0.429  0.6681

## Warning in read.table(file = file, header = header, sep = sep, quote = quote, :
## incomplete final line found by readTableHeader on 'tables/multicomp_silk.csv'